import { request } from './request';
import axios from 'axios';

/**
 * 获取代理商详情通过districtCode
 */
export function kpiGetAgentsByArea(params) {
  return request('/agent/getAgentsByArea', 'get', params)
}
/**
 * 获取疫苗名称通过vaccineType
 */
export function kpiGetVaccineName(params) {
  return request(`/claim/vaccinenames`, 'get', params)
}

/**
 * 登录
 * @param {*userName}
 * @param {*password}
 */
export function kpiLogin(params) {
  return request('/user/login/password', 'get', params)
}
/**
 * 评估报告上传
 */
export function kpiUploadAssessReport(data) {
  return request('/claim/addInformation', 'post', data)
}

/**
 * 获取首页logo通过brandId
 */
export function kpiGetProductbrand(params) {
  return request(`/productBrand/${params.brandId}`, 'get', {})
}
/**
 * 获取登录用户信息
 */
export function kpiUserinfo(params) {
  return request('/user/info', 'get', params)
}
/**
 * 获取登录用户权益信息
 */
export function kpiUserRights(params) {
  return request('/youjia/selectEquityListByUserId', 'get', params)
}
/**
 * 获取权益订单列表信息
 */
export function kpiEquityList(data) {
  return request('/youjia/equityOrder', 'post', data)
}
/**
 * 图文查询列表导出
 */
export function kpiEquityExportList(data) {
  return request('/youjia/equityExportrequest', 'post', data)
}
/**
 * 老用户权益领取
 */
export function kpiOldUserGetRights(params) {
  return request('/youjia/getPolicyInfo', 'get', params)
}
/**
 * 老用户权益领取验证码获取
 */
export function kpiOldUserGetRightsCode(data) {
  return request('/util/verificode', 'post', data)
}
/**
 * 老用户权益领取验证
 */
export function kpiOldUserGetRightsVerify(params) {
  return request('/youjia/whiteList', 'get', params)
}
/**
 * 获取权益订单列表导出
 */
export function kpiExportEquityList(data) {
  return request('/youjia/equityOrderExportrequest', 'post', data)
}
/**
 * 获取权益订单查询
 */
export function kpiQueryEquityList(data) {
  return request('/youjia/equity', 'post', data)
}
/**
 * 赔案查询列表导出
 */
export function kpiExportCliamList(data) {
  return request('/claim/vaccineCaseExportrequest', 'post', data)
}
/**
 * 获取查询记录
 */
export function kpiQueryRecords(params) {
  return request('/youjia/equityRecord', 'get', params)
}
/**
 * 获取保单发票信息
 */
export function kpiBussinessNoInvoice(params) {
  return request(`/picc/invoice/${params.topActualId}`, 'get', {})
}
/**
 * 注册
 * @param {*mobileNo}
 * @param {*password}
 * @param {*smsCode}
 */
export function kpiRegister(params, data) {
  return request('/user/register', 'post', params, data)
}

/**
 * 找回密码
 * @param {*mobileNo}
 * @param {*password}
 * @param {*smsCode}
 */
export function kpiChangePassword(params, data) {
  return request('/user/modifyPassword', 'post', params, data)
}
/**
 * 图片验证码
 */
export function kpiPiccode(params) {
  return request('/user/piccode', 'get', params)
}
/**
 * 发送短信验证码，userName为手机号，图片验证信息必传
 * @param {*picCode}
 * @param {*key}
 * @param {*mobileNo}
 */
export function kpiVerificodeSignup(data) {
  return request('/user/verificode/signup', 'post', data)
}
/**
 * 发送短信验证码，userName为手机号，图片验证信息必传
 * @param {*picCode}
 * @param {*key}
 * @param {*mobileNo}
 */
export function kpiVerificodeChangePassword(data) {
  return request('/user/verificode/modifyPassword', 'post', data)
}
/**
 * 批改与退保 endorseType为endorse时为批改,为cancel时为退保
 * @param {*endorseType}
 * @param {*phoneNumber}
 * @param {*smsCode}
 * @param {*insureName}
 * @param {*gender}
 */
export function kpiEndorseChange(data) {
  return request(`/picc/${data.topActualId}/endorse`, 'post', data)
}
/**
 * 产品列表
 */
export function kpiProducts(params) {
  return request('/products', 'get', params)
}
/**
 * 产品详情
 * @param {*productId} 产品ID
 */
export function kpiProduct(params) {
  return request(`/product/${params.productId}`, 'get', {})
}
/**
 * 保存产品
 */
export function kpiProductPost(data) {
  return request('/product', 'post', data)
}
/**
 * 被保险人信息(团险)
 * @param {*topActualId}
 */
export function kpiPolicyInsuredpage(params) {
  return request('/policy/insuredpage', 'get', params)
}
/**
 * 雇员信息(雇主责任险)
 * @param {*topActualId}
 */
export function kpiPolicyEmployeepage(params) {
  return request('/policy/employeepage', 'get', params)
}
/**
 * 服务器信息(云数据保险)
 * @param {*topActualId}
 */
export function kpiPageDynamicSubject(params) {
  return request('/policy/dynamicsubjectpage', 'get', params)
}
/**
 * 产品类别
 */
export function kpiProductCategories(params) {
  return request('/productCategories', 'get', params)
}

/**
 * 险类下SKU属性
 */
export function kpiProductCategoryProperties(params) {
  return request(`productCategory/${params.categoryId}/categoryProperties`, 'get', params)
}

/**
 * 保存险类下SKU属性
 */
export function kpiSaveProductCategoryProperties(params, data) {
  return request(`productCategory/${params.categoryId}/categoryProperties`, 'post', params, data)
}

/**
 * 保存险类
 */
export function kpiSaveProductCategory(data) {
  return request(`productCategory`, 'post', data)
}

/**
 * 上传清单 // 暂作记录,没有直接使用
 * @param {*file} excel文件
 * @param {*topActualId} 0
 * @param {*productId}
 */
export function kpiPolicyUploadinsureds(data) {
  return request('/policy/uploadinsureds', 'post', data)
}
/**
 * 增删改被保险人信息(团险)
 * @required {*handlerType: insert,update,delete}
 * @required {*productId}
 * @required {*topActualId}
 * @param {*certificateType}
 * @param {*certificateNo}
 * @param {*mobileNo}
 * @param {*planCode}
 * @param {*name}
 * @param {*actualId}
 */
export function kpiPolicyHandlerinsured(params, data) {
  return request('/policy/handlerinsured', 'post', params, data)
}
/**
 * 增删改雇员信息(雇主责任险)
 */
export function kpiPolicyHandleremployee(params, data) {
  return request('/policy/handleremployee', 'post', params, data)
}

/**
 * 投保页面提交审核 (团险)
 * @param {*contract} body
 * @param {*actualId} 就是topActualId被保险人列表的唯一标识
 * @param {*applicant} 投保人信息
 * @param {*plans} 投保计划
 * @param {*policy} 起保日期,终保日期
 */
export function kpiPolicyGroupcontract(data) {
  return request('/policy/groupcontract', 'post', data)
}
/**
 * 投保页面提交审核 (雇主责任险)
 */
export function kpiPolicyEmployeecontract(data) {
  return request('/policy/employeecontract', 'post', data)
}
/**
 * 投保页面提交审核 (云数据保险)
 */
export function kpiPolicyDataContract(data) {
  return request('/policy/datacontract', 'post', data)
}
/**
 * 条目
 * @param {*categoryCode}
 * @param {*PeriodUnit} 起保日期,终保日期
 */
export function kpiEbcsCategoryCode(params) {
  return request(`/ebcs/${params.categoryCode}`, 'get', params)
}
/**
 * 订单待审核列表
 */
export function kpiPolicyPage(params) {
  return request(`/policy/page`, 'get', params)
}
/**
 * 查询证件有效期信息
 */
export function kpiGetCertPage(data) {
  return request(`/policy/errorCertList`, 'post', data)
}
/**
 * 订单审核,通过/退回
 * @param {*topActualId} 订单号
 * @param {*updater.desc} 理由
 * @param {*updater.policyStatus} 100 初始 101 提交成功 102 退回修改 103 审核通过 109 已完成
 */
export function kpiPolicyTopActualIdPut(data) {
  return request(`/policy/${data.topActualId}`, 'put', data)
}
/**
 * 取消订单
 */
export function kpiCancelUnpaidOrders(data) {
  return request(`/policy/clearProposal/${data.businessNo}`, 'post', data)
}

/**
 * 支付接口：
 * 地址：/capli/applyPay/{topActualId}?payType=
 * payType：Wechat|Alipay|ybtb（易宝对公）
 */
export function kpiSelectPayment(params) {
  return request(`/capli/applyPay/${params.topActualId}`, 'get', params)
}
/**
 * 查看订单详情
 */
export function kpiPolicyTopActualIdGet(params) {
  return request(`/policy/${params.topActualId}`, 'get', params)
}
/**
 *企业列表
 * @param {*status} 'approve' 通过审核
 */
export function kpiPageEemployer(params) {
  return request(`/employer/page`, 'get', params)
}
/**
 *企业详情
 * @param {*employerId} 企业ID
 */
export function kpiPageEemployerEmployerId(params) {
  return request(`/employer/${params.employerId}`, 'get', params)
}
/**
 *员工列表
 */
export function kpiPageEemployee(params) {
  return request(`/employee/page`, 'get', params)
}
/**
 * 创建员工
 */
export function kpiCrateEmployee(params, data) {
  return request('/employee/', 'post', params, data)
}
/**
 * 品牌列表
 */
export function kpiProductBrands(params) {
  return request(`/productBrands`, 'get', params)
}
/**
 * 租户基本信息
 */
export function kpiUserTenant(params) {
  return request(`/user/tenant`, 'get', params)
}
/**
 * 创建代理商
 */
export function kpiAgentCreate(data) {
  return request('/agent/create', 'post', data)
}
/**
 * 代理商列表
 */
export function kpiAgentList(params) {
  return request(`/agent/list`, 'get', params)
}
/**
 * 修改代理商
 */
export function kpiAgentUpdate(data) {
  return request('/agent/update', 'put', data)
}
/**
 * 获取代理商详情
 */
export function kpiAgentAgentId(params) {
  return request(`/agent/${params.agentId}`, 'get', {})
}

export function kpiCreateEmployeeExportrequest(params) {
  return request(`/employee/createEmployeeExportrequest`, 'get', params)
}

export function kpiCreatePolicyInsuredExoprtrequest(params) {
  return request(`/policy/${params.topActualId}/createPolicyInsuredExoprtrequest`, 'get', params)
}

export function kpiCreateExportVaccinPolicyExoprtrequest(params) {
  return request(`/policy/exportVaccinPolicy`, 'get', params)
}
//channel导出保单
export function kpiCreateExportChannelPolicyExoprtrequest(params) {
  return request(`/policy/exportChannelPolicy`, 'get', params)
}

export function kpiErrorCertListExportrequest(data) {
  return request('/policy/errorCertListExportrequest', 'post', data)
}

/**
 * 文件列表
 */
export function kpiFindExportable(params) {
  return request(`/adex/findExportable`, 'get', params)
}

/**
 * 导出文件
 */
export function kpiExportFile(params) {
  return request(`/download/excel`, 'get', params)
}
/**
 * 快速录入(工伤险)
 */
export function kpiPolicyCopyinsureds(data) {
  return request('/policy/copyinsureds', 'post', data)
}
/**
 * 快速录入(雇主责任险)
 */
export function kpiPolicyCopyemployee(data) {
  return request('/policy/copyemployee', 'post', data)
}
/**
 * 工作任务,支持分页.我的任务列表
 */
export function kpiWorktask(params, visible) {
  return request(`/worktask`, 'get', params, visible)
}
/**
 * 工作任务,支持分页.我的任务入口统计
 */
export function kpiWorktaskStatistics(params) {
  return request(`/worktask/statistics`, 'get', params)
}
/**
 * 邀请审核改变状态
 * @param {*} taskId
 * @param {*} status 0 退回 1 通过
 */
export function kpiWorktaskInvitionAudit(params) {
  return request(`/worktask/invitionAudit/${params.taskId}`, 'put', params)
}
/**
 * 订单补录
 */
export function kpiPolicyTopActualIdMakeup(data) {
  return request(`/policy/${data.topActualId}/makeup`, 'post', data)
}

export function kpiSubmitEmployer(data) {
  return request('/employer/', 'post', data)
}

export function kpiGetEmployer(params) {
  return request(`/employer/${params.employerId}`, 'get', params)
}

export function kpiChangeEmployerStatus(data) {
  return request('/employer/status', 'post', data)
}

export function kpiGetJsApiConfig(params = { pay: false }) {
  if (params.pay) {
    return request(`/wechat/pay/config`, 'get', params)
  } else {
    return request(`/wechat/config`, 'get', params)
  }
}

export function kpiGeoCode(params) {
  return request(`/util/location`, 'get', params)
}

//用户拒绝定位或定位失败时调用该接口获取用户ip及大致位置
export function kpiGetLocationByIp(Vue) {
  let params
  return request(`/util/getLocationByIp`, 'get', params)
}

export function kpiSendSmsCode(params) {
  return request('/util/smsCode', 'post', params)
}
export function kpiGetImageLink(params) {
  return request(`/pageContent/${params.pageContentId}`, 'get', {})
}
/**
 * 意外险保单保存(做了疫苗险的提交用)
 */
export function kpiPolicyAccidentcontract(data) {
  return request('/policy/accidentcontract', 'post', data)
}
/**
 * 厦门专用意外险保单保存(做了疫苗险的提交用)
 */
export function kpiPolicyXiamenAccidentcontract(data, smsCode) {
  const authorizaHeader = getHeaders();
  const headers = {
    ...authorizaHeader,
    'Accept': 'application/json',
    'smsCode': smsCode
  };
  return axios.post('/api/policy/accidentcontract', data, { headers }).then((res) => {
    return Promise.resolve(res.data);
  });
}
export function kpiPolicyNewAccidentcontract(data, smsCode) {
  const authorizaHeader = getHeaders();
  const headers = {
    ...authorizaHeader,
    'Accept': 'application/json',
    'smsCode': smsCode
  };
  return axios.post('/api/policy/familycontract', data, { headers }).then((res) => {
    return Promise.resolve(res.data);
  });
}
/**
 * 申请支付获取支付链接,payType取值： wechat_jsapi 微信公众号支付|wechat_code 微信二维码支付|wechat_h5 微信H5支付| alipay_web 支付宝WEB端支付|alipay_wap 支付宝WAP端支付
 */
export function kpiPolicyTopActalIdApplyPayPayType(params) {
  return request(`/policy/${params.topActualId}/applyPay/wechat_jsapi`, 'get', params)
}
/**
 * 获取子女数据
 */
export function kpiChildren(params) {
  return request(`/children/`, 'get', params)
}
/**
 * 保存子女数据
 */
export function kpiChildrenPost(data) {
  return request('/children/', 'post', data)
}
/**
 * 获取赔案列表
 */
export function kpiPageVaccineCase(params) {
  return request('/claim/vaccinecase', 'get', params)
}

/**
 * 获取疫苗案件
 */
export function kpiGetVaccineclaim(params) {
  return request(`/claim/vaccineclaim/${params.topActualId}`, 'get', {})
}
/**
 * 车险询价列表
 */
export function kpiPageCarInsurance(params) {
  return request('/policy/findAutoInsurancePC', 'get', params)
}
/**
 * 车险询价保存
 */
export function kpiSaveCarInsurance(data) {
  return request('/policy/autoInsurancePC', 'post', data)
}
/**
 * 询价详情
 */
export function kpiCarInsuranceDetail(params) {
  return request('/policy/findAutoInsuranceData', 'get', params)
}
/**
 * 补传资料
 */
export function kpiAddVaccineclaim(data) {
  return request(`/claim/addInformation`, 'post', data)
}
/**
 * 审核接口
 */
export function kpiExamineVaccineclaim(data) {
  return request(`/claim/caseExamine`, 'post', data)
}
/**
 * 保存疫苗案件
 */
export function kpiSaveVaccineclaim(data) {
  return request(`/claim/vaccineclaim`, 'post', data)
}
/**
 * 根据经纬度获取出单点
 */
export function kpiGetDistanceSortAgent(params) {
  return request(`agent/getDistanceSortAgent`, 'get', params, false)
}
/**
 * 电动助力车保险保单保存
 */
export function kpiPolicyEbikecontract(data) {
  return request(`policy/ebikecontract`, 'post', data)
}
/**
 * 根据省市代码获取区域代码
 * @param {*} districtCode
 */
export function kpiEbcsGetSubDistrict(params) {
  return request(`ebcs/getSubDistrict/${params.districtCode}`, 'get', {})
}

/**
 * 地推时直接通过districtCode获取区域名称
 * @param {*} districtCode
 */
export function kpiEbcsGetDistrict(params) {
  return request(`ebcs/getDistrict/${params.districtCode}`, 'get', {})
}
/**
 * 根据经纬度以及districtCode获取防疫站
 * @param {*latitude} 纬度
 * @param {*longitude} 经度
 * @param {*districtCode}
 */
export function kpiAgentGetAgentByLocation(params) {
  return request(`agent/getAgentByLocation`, 'get', params)
}
/**
 * 海科POS支付项目投保查询接口
 * GET /api/bofc/queryApply
 */
export function kpiBofcQueryApply(params) {
  return request(`bofc/queryApply`, 'get', params)
}
/**
 * 海科业务维护
 */
export function kpiBofcPageApply(params) {
  return request(`bofc/pageApply`, 'get', params)
}
/**
 * 海科业务维护
 */
export function kpiBofcSubmit(data) {
  return request(`bofc/submit`, 'post', data)
}
/**
 * 海科业务核保
 */
export function kpiBofcAudit(params) {
  return request(`bofc/audit`, 'post', params)
}

/**
 * 后台任务处理
 */
export function kpiPageScheduledTask(params) {
  return request(`scheduled/page`, 'get', params)
}

/**
 * 后台任务处理
 */
export function kpiScheduledTaskResend(params, data) {
  return request(`scheduled/resend`, 'post', params, data)
}

/**
 * 后台任务处理
 */
export function kpiScheduledTaskClientLog(params) {
  return request(`scheduled/clientlog`, 'get', params)
}

/**
 * 修改报文信息
 */
export function kpiUpdateResponse(data) {
  return request(`scheduled/updateResponse`, 'post', data)
}
/**
 * 保单列表
 */
export function getPolicyList(pageNo, keyWord, policyStatus='') {
  let userId = JSON.parse(localStorage.getItem('userId'))
  let data = {
    pageNo: pageNo,
    pageSize: 100,
    userId,
    policyStatus
  }
  if (/^[P]\w{21}$/.test(keyWord)) {
    data = {
      pageNo: pageNo,
      pageSize: 100,
      policyNo: keyWord,
      userId,
      policyStatus
    }
  } else if (keyWord !== '') {
    data = {
      pageNo: pageNo,
      pageSize: 100,
      applicantName: keyWord,
      userId,
      policyStatus
    }
  }
  return request(`policy/userPage`, 'get', data)
}
// 疫苗小课堂
export function fetchQuiz(params) {
  return request(`pageQuiz`, 'get', params)
}
/**
 * h5ocr识别
 */
export function kpiCertOCRBase64(data) {
  if (data.billType) {
    return request(`oss/certOCRBase64?filePath=cert_card/`, 'post', data, true)
  }
  return request(`oss/certOCRBase64?filePath=case/${data.billType}/`, 'post', data, true)
}
/**
 * h5ocr识别2
 */
export function kpiCertOCRPICBase64(data) {
  return request(`oss/certBase64?filePath=case/${data.billType}/`, 'post', data, true)
}

// 上传签名图片base64
export function kpiCertBase64(data) {
  return request(`oss/certBase64?filePath=cdc/`, 'post', data, true)
}

/**
 * 对接实名校验服务商API
 */
export function kpiValidatecrtification(params, fourFlag) {
  if (fourFlag) {
    return request(`util/realName4Key`, 'get', params)
  } else {
    return request(`util/realName`, 'get', params)
  }
}
/**
 * 修改手机号
 */
export function midifyMobile(params) {
  return request(`user/modifyMobileNo`, 'get', params)
}
/**
 * 获取验证码
 */
export function getVerificode(params) {
  return request(`/util/verificode`, 'post', params)
}
/**
 * 发送验证码
 */
export function sendVerificode(params) {
  return axios.post(`/api/user/ifUserPhone?mobileNo=${params.mobileNo}`).then((res) => {
    return Promise.resolve(res.data);
  });
}
/**
 * 验证码登录
 */
export function verificodeLogin(params) {
  return axios.post(`/api/user/CodeFindUserInfo?mobileNo=${params.mobileNo}&code=${params.code}`).then((res) => {
    return Promise.resolve(res.data);
  });
}
/**
 * 查询保单
 */
export function queryMyPolicy(params) {
  return request(`/policy/page`, 'get', params)
}

export function queryPolicyPage(params) {
  return request(`/policy/userPage`, 'get', params)
}

/**
 * 查询保单
 */
export function getChannelPolicy(params) {
  return request(`/policy/channelPolicypage`, 'get', params)
}

/**
 * 添加保单
 */
export function addContract(params) {
  return request(`/policy/addContract/${params.topActualId}`, 'post', params)
}
/**
 * 重复投保校验
 */
export function checkReInsured(params) {
  return request(`/policy/reInsured`, 'get', params)
}
/**
 * 疫苗险投保验证码
 */
export function kpiSendInsureCode(params) {
  return request(`/baiGeApplet/sendSms?mobile=${params.mobile}&type=${params.type}`, 'post', params)
}

/**
 * 保单详情
 * */
export function kpiPolicyDetailByBusinessNo(params) {
  return request(`policy/detail`, 'get', params)
}

/**
 * 修改证件有效期
 */
export function kpiUpdateCertificate(data) {
  return request(
    `/policy/${data.topActualId}/updateCertificate?certStartDate=${data.certStartDate}&certEndDate=${data.certEndDate}`,
    'post',
    undefined,
    data,
    Vue
  )
}

/**
 * 保存图片
 */
export function kpiSaveCertImage(data, topActualId) {
  return request(`policy/${topActualId}/saveCertImage`, 'post', data)
}

// 车险询价
export function kpiSaveInquiry(data) {
  return request(`/policy/autoInsurance`, 'post', data)
}

/**
 * 渠道列表
 */
export function kpiChannelsPage(params) {
  return request(`/channel/page`, 'get', params)
}

/**
 * 渠道列表
 */
export function kpiDeleteChannelEmployee(params, data) {
  return request(`/user/deleteChannelEmployee`, 'post', params, data)
}

/**
 * 生成分发二维码
 */
export function kpiPromotionQRcode(params) {
  return request(`/user/promotionQRcode`, 'get', params)
}

/**
 * 渠道出单点列表
 */
export function kpiChannelAreaPage(data) {
  return request(`/channel/getChannelAreaPage`, 'post', data)
}

/**
 * 新增渠道出单点列表
 */
export function kpiAddChannelAreaPage(data) {
  return request(`/channel/insertChannelArea`, 'post', data)
}

/**
 * 编辑渠道出单点列表
 */
export function kpiUpdateChannelAreaPage(data) {
  return request(`/channel/updateChannelArea`, 'post', data)
}

/**
 * 删除渠道出单点列表
 */
export function kpiDeleteChannelAreaPage(data) {
  return request(`/channel/deleteChannelArea`, 'post', data)
}

/**
 * 生成邀请注册链接
 */
export function gitRegisterUrl(data) {
  return request(`/user/inviterequest`, 'post', data)
}

/**
 * 生成邀请注册链接
 */
export function getInviteInfo(params, data) {
  return request(`/user/getInviteInfo`, 'post', params, data)
}
/**
 * 查询协议配置
 */
export function getAgreementPage(data) {
  return request(`/agreement/getAgreementPage`, 'post', data)
}
/**
 * 查询协议配置
 */
export function getAllAgreementProductsByChannelId(params, data) {
  return request(`/agreement/getAllAgreementProductsByChannelId`, 'post', params, data)
}
/**
 * 新增协议配置
 */
export function insertAgreement(data) {
  return request(`/agreement/insertAgreement`, 'post', data)
}
/**
 * 修改协议配置
 */
export function updateAgreement(data) {
  return request(`/agreement/updateAgreement`, 'post', data)
}
/**
 * 查询协议条目
 */
export function getAgreementById(params, data) {
  return request(`/agreement/getAgreementById`, 'post', params, data)
}
/**
 * 添加协议条目
 */
export function insertAgreementItem(data) {
  return request(`/agreement/insertAgreementItem`, 'post', data)
}
/**
 * 删除协议条目
 */
export function deleteAgreementItem(params, data) {
  return request(`/agreement/deleteAgreementItem`, 'post', params, data)
}

/**
 * 新增渠道
 */
export function kpiChannelAdd(data) {
  return request(`/channel/add`, 'post', data)
}

/**
 * 修改渠道
 */
export function kpiChannelModify(data) {
  return request(`/channel/modify`, 'post', data)
}

/**
 * 查询产品报表数据
 */
export function kpiProductStatement(data) {
  return request(`/policy/policyStatistics`, 'post', data)
}
/**
 * 查询统计报表数据
 */
export function kpiStatisticalStatement(data) {
  return request(`/policy/getPolicyChart`, 'post', data)
}
/**
 * 查询统计报表用户权限下的省市区
 */
export function kpiStatisticalProvince(params) {
  return request(`/user/findItemByGroupId`, 'get', params)
}
/**
 * 创建统计报表导出文件
 */
export function kpiStatiscalStatementDown(data) {
  return request(`policy/policyChartExportrequest`, 'post', data, 'blob')
}
/**
 * 创建产品报表导出文件
 */
export function kpiProductStatementDown(data) {
  return request(`policy/policyStatisticsExportrequest`, 'post', data, 'blob')
}

/**
 * 人保公众责任险新增查询
 */
export function kpiLiabilityInsuranceQuery(data) {
  return request(`policy/liabilityInsuranceQuery`, 'post', data)
}

/**
 * 人保公众责任险新增查询
 */
export function kpiLiabilityInsuranceDown(data) {
  return request(`policy/liabilityPolicyExportrequest`, 'post', data)
}
/**
 * 企业实名认证
 */
export function kpiCheckEnterprise(params) {
  return request(`util/checkEnterprise`, 'get', params)
}

/**
 * 企业实名认证
 */
export function kpiGetUnitTypes(params) {
  return request(`ebcs/UnitType`, 'get', params)
}
// 上传证件图并识别
export function kpiUploadImg(data, tempFilePaths) {
  return request(`oss/certOCR?filePath=${tempFilePaths}`, 'post', data)
}
/**
 * 获取项目名称
 */
export function kpiGetTenants(params) {
  return request(`/ebcs/getTenants`, 'get', params)
}
/**
 * 保单查询导出
 */
export function kpiExportPlatformPolicy(params) {
  return request(`/policy/exportPlatformPolicy`, 'get', params)
}

/**
 * 获取渠道名称
 */
export function kpiGetChannel(params) {
  return request(`/channel/page`, 'get', params)
}

/**
 * 业务清单查询
 */
export function kpiGetStatistic(params) {
  return request(`/bofc/pageStatistic`, 'get', params)
}
/**
 * 业务清单下载
 */
export function kpiStatisticDownLoad(params) {
  return request(`/download/ftpzip`, 'get', params)
}
/**
 * 退出要调接口
 */
export function kpiExit(data) {
  return request(`/user/logout`, 'post', data)
}
/**
 * 用户查询
 */
export function kpiUserList(params) {
  return request(`/user/page`, 'get', params)
}
/**
 * 日志查询
 */
export function kpiGetLogList(params) {
  return request(`/bigdata/userOperation/page`, 'get', params)
}
/**
 * 日志导出
 */
export function kpiExportLogList(data) {
  let url = '/bigdata/userOperation/download?pageNo=' + data.pageNo + '&' + 'pageSize=' + data.pageSize + '&' + 'tenantId=' + data.tenantId
  if (data.userId) {
    url += '&' + 'userId=' + data.userId
  }
  if (data.ipAddress) {
    url += '&' + 'ipAddress=' + data.ipAddress
  }
  if (data.extendInfo) {
    url += '&' + 'extendInfo=' + data.extendInfo
  }
  if (data.startDate) {
    url += '&' + 'startDate=' + data.startDate
  }
  if (data.endDate) {
    url += '&' + 'endDate=' + data.endDate
  }
  return request(url, 'post', data)
}
/**
 * 保存单页保单回溯视频(带经纬度)
 */
export function kpiSaveNewPolicyRecall(data, params) {
  const authorizaHeader = getHeaders();
  const headers = {
    ...authorizaHeader,
    'Accept': 'application/json'
  };
  return axios.post(`/api/policy/savePolicyRecallRedis?lonAndLat=${params.lonAndLat}`, data, { headers }).then((res) => {
    return Promise.resolve(res.data);
  });
}
/**
 * 保存单页保单回溯视频(不带经纬度)
 */
export function kpiSavePolicyRecall(data) {
  return request(`/policy/savePolicyRecallRedis`, 'post', data)
}
/**
 * 回溯关联接口
 */
export function kpiRelatedPolicyRecall(data) {
  return request(`/policy/savePolicyRecall`, 'post', data)
}
/**
 * 回溯播放接口
 */
export function kpiFindPolicyRecall(data) {
  return request(`/policy/${data.recallKey}/getPolicyRecallList`, 'post', data)
}
/**
 * 回溯列表接口 operate/queryVideoList
 */
export function kpiGetPolicyRecallList(data) {
  return request(`/policy/recallPolicyList`, 'post', data)
}
/**
 * 延迟险导出接口 operate/queryVideoList
 */
export function kpiBofcExportrequest(data) {
  return request(
    `/bofc/exportApply?pageNo=${data.pageNo}&pageSize=${data.pageSize}&applyDate=${data.applyDate}&channelId=${data.channelId}&businessMark=${data.businessMark}&status=${data.status}`,
    'post',
    undefined,
    data,
    Vue
  )
}
// 汇总分析同比查询接口
export function kpiGetPolicyViewYOY(params) {
  return request('/policyview/policyViewYOY', 'get', params)
}
// 豆小保汇总查询接口
export function kpiGetPolicyViewAllYOY(params) {
  return request('/policyview/policyViewAllYOY', 'get', params)
}
/**
 * 豆小保清单查询
 */
export function kpiGetNoVisiblePage(params) {
  return request('/policyview/noVisiblePage', 'get', params)
}
export function kpiFindProducts(params) {
  return request('/user/findProductsByGroupId', 'get', params)
}
/**
 * 网络安全风险评估
 */
export function kpiGetExaminations(params) {
  return request('/exam/examination/1', 'get', params)
}
export function kpiSubmitExaminations(data) {
  return request('/exam/submit', 'post', data)
}
